import numpy as np

a = np.random.randint(0, 6, [2, 3])
print(a)
print('*' * 10)
b = np.random.randint(0, 6, [3, 2])
print(b)
print('*' * 10)
a.dot(b)
# 3*1+3*5+0*3 3*4+3*0+0*0
# 5*1+4*5+2*3 5*4+4*0+2*0
'''
[[3 3 0]
 [5 4 2]]
**********
[[1 4]
 [5 0]
 [3 0]]
**********
array([[18, 12],
       [31, 20]])
'''

'''
黄金法则
  设axis=i，则Numpy沿着第i个下标变化的方向进行操作，axis由外向里,先横后竖
  该篇文章讲的比较好：https://zhuanlan.zhihu.com/p/31275071
'''
a = np.random.randint(0, 6, [2, 2, 3, 3, 2])
print(a)
print('*' * 10)
print(a.sum(axis=3))

s = np.array_split(a, 2, axis=3)
print(s)
